package com.example.demo.tree;

/**
 * @author wangadmin
 */
public class AvlTree {
    public Node root;


    public void add(int i) {
        if (root == null) {
            root = new Node(null, null, null, i);
        }

        if (i < root.val) {
            root.leftChild = new Node(root, null, null, i);
        } else {

        }
    }

    static class Node {
        Node parent;
        Node leftChild;
        Node rightChild;
        int val;

        public Node(Node parent, Node leftChild, Node rightChild, int val) {
            super();
            this.parent = parent;
            this.leftChild = leftChild;
            this.rightChild = rightChild;
            this.val = val;
        }

        public Node(int val) {
            this(null, null, null, val);
        }

        public Node(Node node, int val) {
            this(node, null, null, val);
        }

    }

}
